package com.zjuh.qss.biz.dao.ibatis;

import java.util.List;

import com.zjuh.qss.biz.dao.CategoryDAO;
import com.zjuh.qss.biz.domain.CategoryDO;

public class CategoryDAOIbatis extends BaseIbatisDAO implements CategoryDAO {
	
	public long create(CategoryDO category) {
		return (Long) this.getSqlMapClientTemplate().insert("CategoryDAO.create", category);
	}

	public void delete(long id) {
		this.getSqlMapClientTemplate().update("CategoryDAO.delete", id);
	}

	public void update(CategoryDO category) {
		this.getSqlMapClientTemplate().update("CategoryDAO.update", category);
	}

	public CategoryDO queryById(long id) {
		return (CategoryDO) this.getSqlMapClientTemplate().queryForObject("CategoryDAO.queryById", id);
	}

	@Override
	public CategoryDO queryByCid(long cid) {
		return (CategoryDO) this.getSqlMapClientTemplate().queryForObject("CategoryDAO.queryByCid", cid);
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<CategoryDO> queryByParentCid(long parentCid) {
		return (List<CategoryDO>) this.getSqlMapClientTemplate().queryForList("CategoryDAO.queryByParentCid", parentCid);
	}

}
